package com.smart.dao;

import com.smart.domain.LoginLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

/**
 * Created by Administrator on 2015/4/28.
 */

@Repository
public class LoginLogDao {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    /***
     * 登录时插入日志相关信息
     * @param loginLog
     */
    public void insertLoginLog(LoginLog loginLog){
        String sqlStr = " insert into t_login_log (user_id, ip, login_datetime) "
                + " values(?,?,?) ";
        Object[] args = { loginLog.getUserId(), loginLog.getIp(), loginLog.getLoginDate() };
        jdbcTemplate.update(sqlStr, args);
    }
}
